<template>
    <div>
      <Form label-position="right" :label-width="400" :model="form">
        <Row class="mb20">
          <Col span="5" class="ivu-form-item-label">登记证编号：</Col>
          <Col span="6" class="ivu-form-item-content">
            <Input v-model="form.acc0m1" placeholder="请输入登记证编号"></Input>
          </Col>
         <!-- <Col span="5" class="ivu-form-item-label">登记类型：</Col>
          <Col span="6" class="ivu-form-item-content">
            <Select v-model="jobItem.adc100" style="width:218px">
              <Option v-for="item in mzList" :value="item.value" :key="item.value">{{ item.label }}</Option>
            </Select>
          </Col>-->
          <Col span="5" class="ivu-form-item-label">实现就业日期：</Col>
          <Col span="6" class="ivu-form-item-content">
            <DatePicker type="date" placeholder="请选择日期" v-model="form.adc110" style="width:280px" @on-change="time"></DatePicker>
          </Col>
        </Row>
        <Row class="mb20">
          <Col span="5" class="ivu-form-item-label">自主就业类型：</Col>
          <Col span="6" class="ivu-form-item-content">
            <Select v-model="form.aac111" style="width:290px">
              <Option v-for="item in zzList" :value="item.value" :key="item.id">{{ item.label }}</Option>
            </Select>
          </Col>
          <Col span="5" class="ivu-form-item-label">岗位种类：</Col>
          <Col span="6" class="ivu-form-item-content">
            <Select v-model="form.acc039" style="width:280px">
              <Option v-for="item in whList" :value="item.value" :key="item.id">{{ item.label }}</Option>
            </Select>
          </Col>
        </Row>
        <Row class="mb20">
          <Col span="5" class="ivu-form-item-label">就业类型：</Col>
          <Col span="6" class="ivu-form-item-content">
            <Select v-model="form.acc032" style="width:290px">
              <Option v-for="(item ,index) in zyList" :value="item.value" :key="index+2">{{ item.label }}</Option>
            </Select>
          </Col>
          <Col span="5" class="ivu-form-item-label">就业登记时间：</Col>
          <Col span="6" class="ivu-form-item-content">
            <DatePicker type="date" placeholder="请选择日期" v-model="form.acc033" style="width:280px" @on-change="time"></DatePicker>
          </Col>
        </Row>
        <Row class="mb20">
          <Col span="5" class="ivu-form-item-label">备注：</Col>
          <Col span="6" class="ivu-form-item-content">
            <Input v-model="form.aae013" placeholder="请输入备注"></Input>
          </Col>
          <Col span="5" class="ivu-form-item-label">经办日期：</Col>
          <Col span="6" class="ivu-form-item-content">
         <!--   <Input  placeholder="请选择日期" v-model="form.aae036" style="width:280px"  @on-focus="saveTime"></Input>-->
            <Input v-model="form.aae036" v-if="form.aae036 === ''" placeholder="请点击获取当前时间" @on-focus="saveTime" style="width:280px"></Input>
            <Input v-model="form.aae036" v-else readonly placeholder="请点击获取当前时间" ></Input>
          </Col>
        </Row>
      </Form>
    </div>
</template>

<script>
import itemdata from '../itemdata'
import { date2str } from '@/api/eventlist'
export default {
  name: 'index.vue',
  props: {
    unemploymentItem1: Object
  },
  watch: {
    // 回显
    unemploymentItem1 (a) {
      if (a !== null) {
        this.form = a
      }
      console.log(a, '555555555555555555')
    }
  },
  data () {
    return {
      form: {
        apiName: 'sq4lhjydj',
        acc0m1: '',
        adc100: '1',
        adc110: '',
        aac111: '',
        acc039: '',
        acc032: '',
        acc033: '',
        aae036: ''
      },
      zzList: itemdata.selfEmploymentList,
      whList: itemdata.jobTypeList,
      zyList: itemdata.selfEmploymentList

    }
  },
  methods: {
    time () {
      this.form.adc110 = date2str(this.form.adc110)
      this.form.acc033 = date2str(this.form.acc033)
      /*  this.form.aae036 = date0str(this.form.aae036) */
    },
    saveTime () {
      let data = new Date()
      let HH = data.getHours()
      HH = HH < 10 ? ('0' + HH) : HH
      let mm = data.getMinutes()
      mm = mm < 10 ? ('0' + mm) : mm
      let ss = data.getSeconds()
      ss = ss < 10 ? ('0' + ss) : ss
      this.form.aae036 = date2str(data) + ' ' + HH + ':' + mm + ':' + ss
    },
    test () {
      if (this.form.acc0m1 === undefined || this.form.acc0m1 === '') {
        this.$Notice.error({ title: '登记证编号', desc: '' })
        return false
      } else if (!this.form.adc110) {
        this.$Notice.error({ title: '请选择就业实现日期', desc: '' })
        return false
      } else if (!this.form.aac111) {
        this.$Notice.error({ title: '请选择自主创业类型', desc: '' })
        return false
      } else if (!this.form.acc039) {
        this.$Notice.error({ title: '请选择岗位种类', desc: '' })
        return false
      } else if (!this.form.acc032) {
        this.$Notice.error({ title: '请选择就业类型', desc: '' })
        return false
      } else if (!this.form.acc033) {
        this.$Notice.error({ title: '请选择就业登记时间', desc: '' })
        return false
      } else if (!this.form.aae036) {
        this.$Notice.error({ title: '请选择经办日期', desc: '' })
        return false
      }
      this.$emit('form', this.form)
    }
  }
}
</script>

<style scoped>

</style>
